package com.ykdl.member.kid.adapters;

import java.util.ArrayList;

import com.lidroid.xutils.BitmapUtils;
import com.ykdl.member.kid.R;
import com.ykdl.member.kid.adapters.MyCardAdapter.ViewHolder;
import com.ykdl.member.kid.beans.ArticleBean;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class MyCard_Gallery_Adaper extends BaseAdapter{

	private ArrayList<ArticleBean>   list;
	private BitmapUtils bitmapUtil ;
	private Context mContext ;
	public MyCard_Gallery_Adaper(Context context){
		mContext = context;
		bitmapUtil = new BitmapUtils(context);
		bitmapUtil.configDefaultLoadingImage(R.drawable.defult_head_icon);
		bitmapUtil.configDefaultLoadFailedImage(R.drawable.defult_head_icon);
	}
	
	public void setList(ArrayList<ArticleBean> list) {
		this.list = list;
		
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
//		if (list==null) {
//			return 0;
//		}else {
//			return list.size();
//		}
		return 4;
	
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		 return list.get(arg0-1);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder = null;
		if (convertView == null) {
			convertView = RelativeLayout.inflate(mContext,
					R.layout.mygoodlife_lunxun, null);
			holder = new ViewHolder();
			holder.store_bg = (RelativeLayout) convertView.findViewById(R.id.store_bg);
			holder.score = (TextView) convertView.findViewById(R.id.score);
			holder.store_name = (TextView) convertView.findViewById(R.id.store_name);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
//		holder.title.setText(list.get(arg0).getTitle());
//		holder.intro.setText(list.get(arg0).getIntro());
//		String url = list.get(arg0).getUrl();
//		bitmapUtil.display(holder.image, url);
		ImageView i = new ImageView(mContext);
        i.setBackgroundColor(0xFF000000);
        i.setScaleType(ImageView.ScaleType.FIT_XY);
        i.setLayoutParams(new Gallery.LayoutParams(
        	     LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		return convertView;
	}
	class ViewHolder {
		RelativeLayout store_bg;
		TextView score;
		TextView store_name;
		
	}


}
